package com.seecen.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.seecen.pojo.entity.TransferRecord;
import com.seecen.pojo.vo.PageVo;
import com.seecen.service.TransferRecordService;
import com.seecen.mapper.TransferRecordMapper;
import com.seecen.utils.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
* @author 酒醉
* @description 针对表【sys_transfer_record】的数据库操作Service实现
* @createDate 2025-10-16 14:32:26
*/
@Service
public class TransferRecordServiceImpl extends ServiceImpl<TransferRecordMapper, TransferRecord>
    implements TransferRecordService{
    @Autowired
    private TransferRecordMapper transferMapper;
    @Override
    public Result transferNews(PageVo pageVo) {
        Page<Map> page = new Page<>(pageVo.getPageNum(), pageVo.getPageSize());
        transferMapper.selectTransferNews(page,pageVo);
        List<Map> records = page.getRecords();
        HashMap<String, Object> pageInfo = new HashMap<>();
        pageInfo.put("pageData",records);
        pageInfo.put("pageSize",page.getSize());
        pageInfo.put("pageNum",page.getCurrent());
        pageInfo.put("totalPage",page.getPages());
        pageInfo.put("totalSize",page.getTotal());
        HashMap<String, Object> data = new HashMap<>();
        data.put("pageInfo",pageInfo);
        return  Result.ok(data);
    }
}




